<template>
  <!-- 送货 -->
  <el-table :data="deliverList" style="width: 100%">
    <el-table-column prop="customerName" label="收货人" min-width="150" />
    <el-table-column prop="address" label="收货地址" min-width="150" />
    <el-table-column prop="deliveryName" label="配送人" width="200" />
    <el-table-column prop="deliverTime" label="配送时间" width="300" />
    <el-table-column prop="statusName" label="送货状态" width="300" />
    <el-table-column prop="remark" label="备注" min-width="200" />
  </el-table>
</template>

<script>
import { queryTypeByDic } from '@/utils/getData'
export default {
  name: 'deliverList',
  data () {
    return {
      deliverList: [],
      typeList: []
    }
  },
  props: {
    list: {
      type: Array,
      required: true,
      default: () => { return [] }
    }
  },
  watch: {
    list (val) {
      if (val) {
        this.deliverList = val
        this.typeList.forEach(item => {
          this.deliverList.map(q_item => {
            if (q_item.status == item.value) {
              q_item.statusName = item.name
            }
          })
        })
        console.log(this.deliverList)
      }
    }
  },
  mounted () {
    this.getStatus()
  },
  methods: {
    // 获取送货状态
    async getStatus () {
      let data = await queryTypeByDic('deliverStatus')
      this.typeList = data
    }
  }
}
</script>

<style>
</style>